;(function (root) {

    function AudioManage() {
        this.audio = new Audio()
        this.status = 'pause' // 歌曲整体，默认暂停

    }

    AudioManage.prototype = {
        load(src){
            this.audio.src = src; // 设置音乐播放路径
            this.audio.load();// 加载音乐
        },
        play(){
            this.audio.play();
            this.status = 'play'
        },
        pause(){
            this.audio.pause();
            this.status = 'pause'
        },

        end(fu){ // 播放完成
            this.audio.onended = fu
        },

        playTo(time){ // 跳转音乐某个时间点
            this.audio.currentTime = time // 单位 s
        },
    }

    root.music = new AudioManage()
    
})(window.player || (window.player = {}));